const NinelineModel = require("../model/NinelineModel")

class NinelineService {
    async startGame(userId, betAmount){
        try{
            let result = await new NinelineModel().startGame(userId, betAmount)
            return result;
        }catch(err){
            throw err;
        }
    }

    async getStat(userId){
        try{
            let ninelineModel = new NinelineModel();
            let {totalBet,totalWin, platTotalBet, platTotalWin} = await ninelineModel.getUserAllBetAndTotalWins(userId)
            return {totalBet,totalWin, platTotalBet, platTotalWin} 
        }catch(err){
            throw err;
        }
    }

    async clearUserData(userId){
        try{
            let ninelineModel = new NinelineModel();
            await ninelineModel.clearUserData(userId)
        }catch(err){
            throw err;
        }
    }
    async clearSystemData(){
        try{
            let ninelineModel = new NinelineModel();
            await ninelineModel.clearSystemData()
        }catch(err){
            throw err;
        }
    }
}

module.exports = NinelineService;